'use strict';

module.exports = app => {
  const { STRING, INTEGER, TEXT, TINYINT, DATE } = app.Sequelize;

  const Notice = app.model.define('notice', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    title: {
      type: STRING(255),
      allowNull: true,
      comment: '公告标题'
    },
    img: {
      type: STRING(255),
      allowNull: true,
      comment: '图片'
    },
    content: {
      type: TEXT,
      allowNull: true,
      comment: '公告内容'
    },
    sort: {
      type: INTEGER,
      allowNull: true,
      defaultValue: 0,
      comment: '排序值'
    },
    status: {
      type: TINYINT,
      allowNull: true,
      defaultValue: 1,
      comment: '状态：1-正常，0-禁用'
    },
    created_at: DATE,
    updated_at: DATE,
  }, {
    tableName: 'notices',
    timestamps: true,
  });

  return Notice;
};
